package com.ruoyi.teaching.mapper;

import java.util.List;
import java.util.Set;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.teaching.domain.HighInterview;
import com.ruoyi.teaching.domain.vo.InterviewMaseryList;
import com.ruoyi.teaching.domain.vo.RelatedInterviewVo;
import com.ruoyi.teaching.domain.vo.SelectInterviewMasery;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 高频面试题Mapper接口
 *
 * @author sunshine
 * @date 2024-01-25
 */
public interface HighInterviewMapper extends BaseMapper<HighInterview>
{
    /**
     * 查询高频面试题
     *
     * @param id 高频面试题主键
     * @return 高频面试题
     */
    public HighInterview selectHighInterviewById(Long id);

    /**
     * 查询高频面试题列表
     *
     * @param highInterview 高频面试题
     * @return 高频面试题集合
     */
    public List<HighInterview> selectHighInterviewList(HighInterview highInterview);

    /**
     * 新增高频面试题
     *
     * @param highInterview 高频面试题
     * @return 结果
     */
    public int insertHighInterview(HighInterview highInterview);

    /**
     * 修改高频面试题
     *
     * @param highInterview 高频面试题
     * @return 结果
     */
    public int updateHighInterview(HighInterview highInterview);

    /**
     * 删除高频面试题
     *
     * @param id 高频面试题主键
     * @return 结果
     */
    public int deleteHighInterviewById(Long id);

    /**
     * 批量删除高频面试题
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteHighInterviewByIds(Long[] ids);


    List<InterviewMaseryList> listInterviewMastery(SelectInterviewMasery selectInterviewMasery);

    /**
     * cid-id选择高级面试
     *
     * @param cdId cd id
     * @return {@link List}<{@link HighInterview}>
     */
    @Select("SELECT\n" +
            "\ti.id,\n" +
            "\ti.question \n" +
            "FROM\n" +
            "\tya_high_interview AS i\n" +
            "\tINNER JOIN ya_course_design_interview AS cdi ON i.id = cdi.interview_id \n" +
            "WHERE\n" +
            "\tcdi.cd_id = #{cdId}")
    List<HighInterview> selectHighInterviewByCidId(@Param("cdId") Long cdId);

    /**
     * 按关键词选择高级面试
     *
     * @param keywords 关键字
     * @return {@link List}<{@link HighInterview}>
     */
    List<HighInterview> selectHighInterviewByKeyWords(@Param("keywords") Set<String> keywords);
}
